package com.company;

import java.util.Scanner;

/**
 * @author jrue
 * @version 1.0
 * @date 2020/3/19 15:44
 */
public class Main11 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String s = sc.next();
            long res = 0;
            for (int i = 0; i < s.length(); i++) {
                int a = s.charAt(i) - 'a';
                res = res * 26 + a;
            }
            System.out.println(res);
        }
    }
}
